package controller;

import java.io.IOException;

import model.Exams;
import model.Video;

import org.zkoss.util.media.Media;
import org.zkoss.zk.ui.Component;
import org.zkoss.zk.ui.Executions;
import org.zkoss.zk.ui.event.UploadEvent;
import org.zkoss.zk.ui.select.SelectorComposer;
import org.zkoss.zk.ui.select.annotation.Listen;
import org.zkoss.zk.ui.select.annotation.Wire;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Textbox;

import util.FileUtils;

import admin.dao.ExamsDAO;
import admin.dao.VideoDAO;

public class AddTestCtrl extends SelectorComposer<Component>{
	private static final long serialVersionUID = 1L;

	@Wire
    private Textbox txtTestname;
	@Wire
	private Textbox txtTestID;
	@Wire
	private Combobox listType;
	
	@Listen("onClick = #btSubmit")
    public void submit(){
			ExamsDAO.addExams(new Exams(0, listType.getValue(), txtTestname.getValue(), txtTestID.getValue(), listType.getSelectedItem().getValue().toString()));
			Executions.getCurrent().sendRedirect("test_layout.jsp");
    }
}
